package use.thread.interrupt;

public class InterruptedExample {
     static class MyThread1 extends Thread {
        @Override
        public void run() {
            while (!interrupted()) {
                System.out.println("1111");
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new MyThread1();
        thread.start();
        Thread.sleep(5000);
        thread.interrupt();
    }
}
